package com.freesky.common.exception;


import com.freesky.common.enums.ResponseEnum;
import com.freesky.common.utils.reponse.JSONResponse;
import lombok.Data;

@Data
public class MyException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private JSONResponse response;
    private Throwable throwable;

    public MyException(ResponseEnum responseEnum, Throwable throwable, Object data) {
        super(responseEnum.getMsg());
        this.response = new JSONResponse();
        this.response.setCode(responseEnum.getCode());
        this.response.setMsg(responseEnum.getMsg());
        this.response.setData(data);
        this.throwable = throwable;
    }

}
